package crm.view.funktionBar.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import crm.model.teacherPC.Manager;

public class InternetStopListener implements ActionListener{

	Manager manager;
	public InternetStopListener(Manager manager){
		this.manager=manager;
	}
	public void actionPerformed(ActionEvent ev) {
		JButton but = (JButton)ev.getSource();
		if (but.getActionCommand().equals("Internet Sperren")){
			for(int i = 0; i< manager.getStudentCount(); i++){
				manager.getStudent(i).setBrowserCloseOn(true);
			}
			but.setText("Internet Sperrung aufheben");
		}else if (but.getActionCommand().equals("Internet Sperrung aufheben")){
			for(int i = 0; i< manager.getStudentCount(); i++){
				manager.getStudent(i).setBrowserCloseOn(false);
			}
			but.setText("Internet Sperren");
		}
	}
}
